#include<iostream>
using namespace std;
void testRefToPointer() {
   int i=10;
   int &ri=i;
   cout<<i<<endl;
   cout<<ri<<endl;
   
   int *pi=&i;
   int *&rpi=pi;
   cout<<*pi<<endl;
   cout<<*rpi<<endl;
}
void testRefToConst() {
   int i=10;
   const int &rci=i;
   cout<<i<<endl<<rci<<endl;
   i++;
   cout<<i<<endl<<rci<<endl;
   //rci++; //error: increment of read-only reference ‘rci’
}
void testRefAssignment() {
   int i=10;
   int &ri=i;
   int &rj=ri;
   cout<<i<<endl;
   cout<<ri<<endl;
   cout<<rj<<endl;
}
int main() {
   //testRefToPointer();
   testRefToConst();
   //testRefAssignment();
   return 0;
}
